﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Model.Repositories;
using Domain.Model.Infractores;
using Domain.Model.Base;
using Domain.Model.Direcciones;

namespace Infrastructure.Base.InMemory
{
    public class MInfractorRepository : InfractorRepository
    {
        private Dictionary<InfractorId, Infractor> lista;

        public MInfractorRepository()
        {
            this.lista = new Dictionary<InfractorId, Infractor>();

        }


        public override void Insert(Infractor entity)
        {
            this.lista.Add((InfractorId)entity.Identity, entity);
        }

        public override Infractor FromId(ObjectIdentity id)
        {
            return this.lista[(InfractorId)id];
        }

        public override ObjectIdentity NextIdentity()
        {
            return new InfractorId(Guid.NewGuid().ToString().ToUpper());
        }

        public override void Update(Infractor entity)
        {
            throw new NotImplementedException();
        }

        public override void Remove(ObjectIdentity id)
        {
            this.lista.Remove((InfractorId)id);
        }

        public override List<Infractor> All()
        {
            return new List<Infractor>(this.lista.Values);
        }

        public override int Count()
        {
            return this.lista.Values.Count;
        }


        public override InfractorId FromIdentificacion(string numIdentificacion)
        {
            throw new NotImplementedException();
        }
    }
}
